---
title: clsHazardGroupCollection
summary: API reference for clsHazardGroupCollection.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-21
library: SAIF.Business.Policy
reference_type: package
---

# clsHazardGroupCollection

`clsHazardGroupCollection` is the read-only SAIF BOF business collection that retrieves `HAZARD_GROUP` rows in force on a caller-supplied effective date. It is the library's only type routed through the BOF data portal's `BeforeRetrieve`/`AfterRetrieve` lifecycle ([OP-01](../../operations-processes.md)), and enforces the effective-dating rule ([BR-POL-001](../../business-rules.md#br-pol-001-hazard-group-effective-dating)) and read-only surface ([BR-POL-002](../../business-rules.md#br-pol-002-hazard-group-data-is-read-only)) for hazard-group data.

## Purpose
- Retrieve and hold the set of `clsHazardGroup` instances effective on a given date, delegating SQL execution to the BOF data portal in `SAIF.BOF.Framework`.
- Provide lookup, containment, and removal operations over the retrieved set keyed on `HazardGroupID` ([BR-POL-003](../../business-rules.md#br-pol-003-hazard-group-identity)).
- Forbid edit, add, and remove at the collection level (`AllowEdit=False`, `AllowRemove=False`, `IsSavable=False`), making hazard-group retrieval a query-only operation ([BR-POL-002](../../business-rules.md#br-pol-002-hazard-group-data-is-read-only)).

## Context
- Namespace: `SAIF.Business.Policy`
- Assembly/package: `SAIF.Business.Policy` (`PolicyCommon`)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Item(Index)` | `Default Overloads ReadOnly Property Item(Index As Integer) As clsHazardGroup` | Positional access into the retrieved collection. |
| `ItemByKey(inHazardGroupID)` | `ReadOnly Property ItemByKey(inHazardGroupID As String) As clsHazardGroup` | Finds a hazard group by id via linear scan; returns the last enumerated item (or `Nothing` on an empty list) when no match is found — a fall-through defect.* |
| `MyCriteria` | `ReadOnly Property MyCriteria As Criteria` | Strongly typed access to the collection's `Criteria`; `<Browsable(False)>`. |
| `IsValid` | `Overrides ReadOnly Property IsValid As Boolean` | Always returns `True` — the collection performs no cross-item validation. |
| `IsSavable` | `ReadOnly Property IsSavable As Boolean` | Always returns `False`, enforcing BR-POL-002 at the collection level. |
| `Contains(clsHazardGroup)` | `Overloads Function Contains(item As clsHazardGroup) As Boolean` | Tests whether the collection holds the given hazard group by identity. |
| `Contains(String)` | `Overloads Function Contains(inHazardGroupID As String) As Boolean` | Tests whether the collection holds a hazard group with the given id. |
| `ContainsDeleted(clsHazardGroup)` | `Overloads Function ContainsDeleted(item As clsHazardGroup) As Boolean` | Scans `m_deletedList` for the given hazard group by identity. |
| `ContainsDeleted(String)` | `Overloads Function ContainsDeleted(inHazardGroupID As String) As Boolean` | Scans `m_deletedList` for a hazard group with the given id. |
| `Remove(clsHazardGroup)` | `Overloads Sub Remove(item As clsHazardGroup)` | Removes a hazard group instance from the collection. |
| `Remove(String)` | `Overloads Sub Remove(inHazardGroupID As String)` | Removes the hazard group matching the given id from the collection. |
| `GetHazardGroups(inDataportal, inEffectiveDate)` | `Shared Function GetHazardGroups(inDataportal As IDataPortalInfo, inEffectiveDate As Date) As clsHazardGroupCollection` | Current entry point: constructs `Criteria` and retrieves hazard groups effective on the given date through the BOF data portal (OP-01). |
| `GetHazardGroupCollection(inDataportal, inEffectiveDate)` | `<Obsolete("Use GetHazardGroups instead.")> Shared Function GetHazardGroupCollection(inDataportal As IDataPortalInfo, inEffectiveDate As Date) As clsHazardGroupCollection` | Deprecated twin of `GetHazardGroups` with an identical body; retained for backward compatibility. |

## Behavioral notes
- `BeforeRetrieve`/`AfterRetrieve` (protected overrides, not public surface) build the `IDataRequest`, assign `Criteria.RetrieveSQL`, bind `EffectiveDate`, and hydrate one `clsHazardGroup` per result row via `Load` ([OP-01](../../operations-processes.md), [OP-02](../../operations-processes.md)).
- No explicit exception handling wraps retrieval; data-access exceptions from the framework propagate to the caller.
- The nested `Criteria` class implements `IBusinessCriteria` with `EffectiveDate` as its only public property; `RetrieveSQL` is implemented while `CreateSQL`/`InsertSQL`/`UpdateSQL`/`DeleteSQL` throw `ApplicationException(clsConstants.Messages.InvalidSQLProperty)`.
- `Protected Sub New()` sets `AllowEdit=False`, `AllowRemove=False`, `AllowSort=True`, `AllowFind=True` — sorting and finding are permitted, mutation is not.

## Constraints and usage notes
- No in-repo consumer of `clsHazardGroupCollection` was found; it exists for other applications that consume this library.*
- Callers should prefer `GetHazardGroups` over the `<Obsolete>` `GetHazardGroupCollection`, which has an identical body.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- SAIF.Business.Policy/clsHazardGroupCollection.vb
